package com.pearadmin.modules.blog.service.impl;

import com.pearadmin.modules.blog.domain.Banner;
import com.pearadmin.modules.blog.mapper.BannerMapper;
import com.pearadmin.modules.blog.service.IBannerService;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("bannerService")
public class BannerServiceImpl implements IBannerService{



    @Resource
    BannerMapper bannerMapper;

    @Override
    public List<Banner> selectList(Banner param) {
        return bannerMapper.selectList(param);
    }


    @Override
    public PageInfo<Banner> page(Banner param, PageDomain pageDomain) {
        PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit());
        List<Banner> banners = bannerMapper.selectList(param);
        return new PageInfo<>(banners);
    }

    @Override
    public Integer insert(Banner banner) {
        return bannerMapper.insert(banner);
    }

    @Override
    public Banner selectById(Integer id) {
        return bannerMapper.selectById(id);
    }

    @Override
    public Integer updateById(Banner banner) {
        return bannerMapper.updateById(banner);
    }

    @Override
    public Integer deleteById(Integer id) {
        return bannerMapper.deleteById(id);
    }

    @Override
    public Integer deleteByIds(Object[] ids) {
        return bannerMapper.deleteByIds(ids);
    }

    @Override
    public List<Banner> findTop5() {
        return bannerMapper.findTop5();
    }



}
